/**
 * Project Name:springBoot-model
 * File Name:TestValid.java
 * Package Name:com.libra.model.vo
 * Date:2018年8月3日下午2:32:01
 * Copyright (c) 2018, wangzhch All Rights Reserved.
 *
*/

package com.libra.model.vo;

import java.io.Serializable;

import javax.validation.constraints.AssertFalse;
import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.CreditCardNumber;
import org.hibernate.validator.constraints.URL;

import lombok.Data;

/**
 * ClassName:TestValid <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason:	 TODO ADD REASON. <br/>
 * Date:     2018年8月3日 下午2:32:01 <br/>
 * @author   wangzhch
 * @version  
 * @since    JDK 1.8
 * @see 	 
 */
@Data
public class TestValidRequest implements Serializable{
	@AssertTrue(message = "9012:assertTrue的值不为true")
	private boolean assertTrue; // 这里声明的变量不能为isTrue 或 isFalse

	@AssertFalse(message = "90013:assertFalse的值不为false")
	private boolean assertFalse;
	
	//正则表达式
	@Pattern(regexp = ".*[a-zA-Z]+.*", message = "9016:existZiMu该字段的值必须包含字母")
	private String existZiMu;
	
	@DecimalMax(value = "100", message = "9014:minEqNum该字段的值只能小于或等于100")//只能小于或等于
	private Integer minEqNum;
	
	@DecimalMin(value = "200", message = "9015:maxEqNum该字段的值只能大于或等于200")
	private Integer maxEqNum;
	
	@Min(value = 18, message = "9001:minNum小于最小值")
	private Integer minNum;

	@Max(value = 60, message = "9002:maxNum超过最大值")
	private Integer maxNum;

	@NotBlank(message = "9003:notBlank不能为空,检查时会将空格忽略")
	private String notBlank;

	@NotNull(message = "9004:notNull不能为空")
	private String notNull;

	@NotEmpty(message = "9005:notEmpty不能为空,空字符串")
	private String notEmpty;

	@Size(min = 5, max = 10, message = "9006:size不在5和10之间")
	private String size;

//	@DateTimeFormat(pattern = "yyyyMMddHHmmss")
//	@Past(message = "9007:beforeDate该字段的日期不是在过去")
//	private Date beforeDate;  //这个有问题

//	@DateTimeFormat(pattern = "yyyyMMddHHmmss")
//	@Future(message = "9008:afterDate该字段的日期不是在将来")
//	private Date afterDate;   //这个有问题

	@Email(message = "9009:email该字段不是一个正确的邮箱号")
	private String email;

	/** hibernate的验证 */
	@CreditCardNumber(message = "90010:cardNumber该字段对银行卡号进行一个大致的验证,仅作参考")
	private String cardNumber;

	@URL(message = "90011:url不是一个有效的地址") // 如果提供了protocol,host,port等,则该url还需满足提供的条件
	private String url;
}

